﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace DBTools.DBUpdate
{
    public partial class FormBase : Form
    {
        public string FormCode = Guid.NewGuid().ToString();
        private string _AppPath = Application.StartupPath;
        public string AppPath
        {
            get
            {
                return _AppPath;
            }
            set
            {
                _AppPath = value;
            }
        }
        public FormBase()
        {
            InitializeComponent();

        }
        /// <summary>
        /// 重载窗体消息
        /// </summary>
        /// <param name="m"></param>
        protected override void WndProc(ref   Message m)
        {

            if (this.WindowState == FormWindowState.Maximized)
            {
                if (m.Msg != 0x0003 && m.WParam != (IntPtr)0xF012)//
                {
                    base.WndProc(ref m);
                }
            }
            else
            {
                base.WndProc(ref m);
            }



            //////屏掉系统菜单
            //if (m.Msg == 0xa1 && (int)m.WParam == 0x3)
            //{
            //    return;
            //}
            ////if (m.Msg == 0xa3 && ((int)m.WParam == 0x3 || (int)m.WParam == 0x2))
            ////{
            ////    return;
            ////}
            //if (m.Msg == 0xa4 && ((int)m.WParam == 0x2 || (int)m.WParam == 0x3))
            //{
            //    return;
            //}
            //if (m.Msg == 0x112 && (int)m.WParam == 0xf100)
            //{
            //    return;
            //}
            //base.WndProc(ref m);
        }
        WaitDialog_New T;
        public void SetWaitDialogCaptionHasProcess(string fCaption)
        {
            if (T == null)
            {
                T = new WaitDialog_New();
            }
            T.SetWaitDialogCaption(fCaption, this);
        }

        public void SetWaitDialogCaption(string fCaption)
        {
            if (T == null)
            {
                T = new WaitDialog_New();
            }
            T.SetWaitDialogCaption(fCaption, this, false);
        }
        public void CloseWaitDialog()
        {
            if (T != null)
            {
                T.CloseWaitDialog(this);
            }
        }
        public void ShowDefaultWait()
        {
            SetWaitDialogCaptionHasProcess("正在处理数据...");
        }
        public void CloseDefaultWait()
        {
            CloseWaitDialog();
        }
    }
}